package com.dcd.service.impl;

import com.dcd.pojo.Information;
import com.dcd.service.InformationService;
import org.apache.solr.client.solrj.SolrServerException;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.IOException;
import java.util.*;

@Service
public class InformationServiceImpl implements InformationService{
    /**
     * 查询所有资讯
     * @return
     */
    @Override
    public Map<String, Object> Information_all(Integer pageZiXunIndex) {
        Map<String,Object> map = new HashMap<>();
        List<Information> list = new ArrayList<Information>();
        Information information = new Information();
        information.setInformation_id(2);
        information.setInformation_car_model_fk_id(1772);
        information.setInformation_release_user_fk_id(1);
        information.setInformation_images_fk_id(2);
        information.setInformation_content_fk_id(2);
        information.setInformation_title("解析蔚来ES6智能驾驶辅助系统：安全性高，不过有瑕疵111");
        information.setInformation_release_date(new Date());
        information.setInformation_read_count(996);
        list.add(information);
        System.err.println(list.size());
        map.put("ziXunList",list);    //ziXunList:托底数据
        return map;
    }

    /**
     * 根据资讯id查询单个资讯详情
     * @return
     */
    @Override
    public Information singleInformation(Integer information_id) {
        Information information = new Information();
        information.setInformation_id(2);
        information.setInformation_car_model_fk_id(1772);
        information.setInformation_release_user_fk_id(1);
        information.setInformation_images_fk_id(2);
        information.setInformation_content_fk_id(2);
        information.setInformation_title("解析蔚来ES6智能驾驶辅助系统：安全性高，不过有瑕疵111");
        information.setInformation_release_date(new Date());
        information.setInformation_read_count(996);
        return information;
    }

    /**
     * 查询前十的热搜榜
     * @return
     */
    @Override
    public List<Information> tenInfoAll() {
        List<Information> list = new ArrayList<Information>();
        Information information = new Information();
        information.setInformation_id(2);
        information.setInformation_car_model_fk_id(1772);
        information.setInformation_release_user_fk_id(1);
        information.setInformation_images_fk_id(2);
        information.setInformation_content_fk_id(2);
        information.setInformation_title("解析蔚来ES6智能驾驶辅助系统：安全性高，不过有瑕疵111");
        information.setInformation_release_date(new Date());
        information.setInformation_read_count(996);
        list.add(information);
        return list;
    }

    /**
     * 查询首页24条资讯的托底数据
     * @return
     */
    @Override
    public List<Information> select_index_information() {
        List<Information> list = new ArrayList<Information>();
        Information information = new Information();
        information.setInformation_id(2);
        information.setInformation_car_model_fk_id(1772);
        information.setInformation_release_user_fk_id(1);
        information.setInformation_images_fk_id(2);
        information.setInformation_content_fk_id(2);
        information.setInformation_title("解析蔚来ES6智能驾驶辅助系统：安全性高，不过有瑕疵111");
        information.setInformation_release_date(new Date());
        information.setInformation_read_count(996);
        list.add(information);
        return list;
    }

    /**
     * 根据车系id查询此系列的所有资讯
     * @param car_series_id   获取车系id
     * @return 返回同车系所有资讯
     */
    @Override
    public List<Information> seleCarSeriesInformation(Integer car_series_id) {
        List<Information> list = new ArrayList<Information>();
        Information information = new Information();
        information.setInformation_id(2);
        information.setInformation_car_model_fk_id(1772);
        information.setInformation_release_user_fk_id(1);
        information.setInformation_images_fk_id(2);
        information.setInformation_content_fk_id(2);
        information.setInformation_title("解析蔚来ES6智能驾驶辅助系统：安全性高，不过有瑕疵222");
        information.setInformation_release_date(new Date());
        information.setInformation_read_count(996);
        list.add(information);
        return list;
    }

    @Override
    public List<Information> select_week() {
        return null;
    }

    @Override
    public Map<String, Object> select_information_by_solr(String solr_content, int page_index) throws IOException, SolrServerException {
        return null;
    }
}
